package com.fivestyle.Ossutils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

//当项目启动，spring接口加载后会执行一个方法
@Component
public class ConstPropertiesUtils implements InitializingBean {
    //读取文件配置
    @Value("${aliyun.oss.file.endpoint}")
    private String endpoint;
    @Value("${aliyun.oss.file.keyid}")

    private  String keyId;
    @Value("${aliyun.oss.file.keysecret}")

    private String keySecret;

    @Value("${aliyun.oss.file.bucketname}")
    private String bucketName;

    //公开静态常量

    public static String EndPoint;
    public static String KeyId;
    public static String KeySecret;
    public static String BucketName;

    @Override
    public void afterPropertiesSet() throws Exception {
            EndPoint=endpoint;
            KeyId=keyId;
            KeySecret=keySecret;
            BucketName=bucketName;
//        System.out.println("&&&&&&&&&&&&&");
    }
}
